<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<HTML><HEAD><TITLE>Man page of XBEE_CONRX</TITLE>
</HEAD><BODY>
<H1>XBEE_CONRX</H1>
Section: Linux Programmer's Manual (3)<BR>Updated: 04-Mar-2012<BR><A HREF="#index">Index</A>
<A HREF="../index.html">Return to Main Contents</A><HR>

<A NAME="lbAB">&nbsp;</A>
<H2>NAME</H2>

xbee_conRx
<A NAME="lbAC">&nbsp;</A>
<H2>SYNOPSIS</H2>

<B>#include &lt;<A HREF="file:///usr/include/xbee.h">xbee.h</A>&gt;</B>

<P>
<B>xbee_err xbee_conRx(struct xbee_con *</B><I>con</I><B>, struct xbee_pkt **</B><I>retPkt</I><B>, int *</B><I>remainingPackets</I><B>);</B>

<P>
<B>xbee_err xbee_conRxWait(struct xbee_con *</B><I>con</I><B>, struct xbee_pkt **</B><I>retPkt</I><B>, int *</B><I>remainingPackets</I><B>);</B>

<A NAME="lbAD">&nbsp;</A>
<H2>DESCRIPTION</H2>

<B>xbee_conRx</B>()

allows you to retrieve information from an active connection.
<I>con</I>

must be non-NULL, and must point at a valid connection. At least one of
<I>retPkt</I> and <I>remainingPackets</I>

must be non-NULL.
<P>
<I>retPkt</I>

may optionally be non-NULL, in which case the next packet in the connection's buffer is returned to you.
If you receive a packet from a connection, you must not forget to call
<B><A HREF="../man3/xbee_pktFree.3.html">xbee_pktFree</A></B>(3)

when you are finished with it.
If
<I>retPkt</I>

is non-NULL, and a callback has been configured for the connection, then
<B>XBEE_EINVAL</B>

will be returned and neither
<I>retPkt</I> or <I>remainingPackets</I>

will have been updated - see
<B><A HREF="../man3/xbee_conCallbackSet.3.html">xbee_conCallbackSet</A></B>(3)

for more information.
<P>
<I>remainingPackets</I>

may also optionally be non-NULL. If it is non-NULL, then it will be populated with the number of packets that are currently in the connection's buffer.
<P>
When a callback is enabled,
<B>xbee_conRx</B>()

may be called with
<I>retPkt</I>

set to NULL, and
<I>remainingPackets</I>

set as non-NULL.
<P>
<B>xbee_conRxWait</B>()

is identical to
<B>xbee_conRx</B>(),

except that it will busy-wait for upto 1 second, checking if there is a packet available.
<A NAME="lbAE">&nbsp;</A>
<H3>Return Value</H3>

On success this function will return XBEE_ENONE, otherwise an error number from
<I>enum xbee_errors</I> (as specified in <I>&lt;<A HREF="file:///usr/include/xbee.h">xbee.h</A>&gt;</I>).

<P>
XBEE_ENOTEXISTS will be returned if there is no packet available to retrieved.
<A NAME="lbAF">&nbsp;</A>
<H2>EXAMPLE</H2>


<PRE>
#include &lt;<A HREF="file:///usr/include/xbee.h">xbee.h</A>&gt;

struct xbee *xbee;
struct xbee_con *con;
struct xbee_pkt *pkt;

/* initialize xbee, using xbee_setup() */

/* initialize con, using xbee_conNew() */

/* receive some data for con */

if (xbee_conRx(con, &amp;pkt, NULL) != XBEE_ENONE) return;

/* use pkt */

if (xbee_pktFree(pkt) != XBEE_ENONE) return;
</PRE>


<A NAME="lbAG">&nbsp;</A>
<H2>AUTHOR</H2>

Attie Grande &lt;<A HREF="mailto:attie@attie.co.uk">attie@attie.co.uk</A>&gt; 
<A NAME="lbAH">&nbsp;</A>
<H2>SEE ALSO</H2>

<B><A HREF="../man3/libxbee.3.html">libxbee</A></B>(3)

<B><A HREF="../man3/xbee_setup.3.html">xbee_setup</A></B>(3),

<B><A HREF="../man3/xbee_conNew.3.html">xbee_conNew</A></B>(3),

<B><A HREF="../man3/xbee_pktFree.3.html">xbee_pktFree</A></B>(3),

<B><A HREF="../man3/xbee_conCallbackSet.3.html">xbee_conCallbackSet</A></B>(3)

<P>

<HR>
<A NAME="index">&nbsp;</A><H2>Index</H2>
<DL>
<DT><A HREF="#lbAB">NAME</A><DD>
<DT><A HREF="#lbAC">SYNOPSIS</A><DD>
<DT><A HREF="#lbAD">DESCRIPTION</A><DD>
<DL>
<DT><A HREF="#lbAE">Return Value</A><DD>
</DL>
<DT><A HREF="#lbAF">EXAMPLE</A><DD>
<DT><A HREF="#lbAG">AUTHOR</A><DD>
<DT><A HREF="#lbAH">SEE ALSO</A><DD>
</DL>
<HR>
This document was created by
<A HREF="/cgi-bin/man/man2html">man2html</A>,
using the manual pages.<BR>
Time: 18:19:28 GMT, September 04, 2013
</BODY>
</HTML>
